/**
 * Copyright (c) 2009 Teoti Graphix, LLC See:
 *     http://tkarchitecture.teotigraphix.org
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 * @author Michael Schmalle mschmalle@teotigraphix.com
 */
package org.teotigraphix.dx.patterns.manager
{

import flash.display.DisplayObjectContainer;
import flash.events.IEventDispatcher;

import org.teotigraphix.dx.core.ToolKitUtil;
import org.teotigraphix.dx.interfaces.IComponentSkin;
import org.teotigraphix.dx.interfaces.IToolKitComponent;
import org.teotigraphix.dx.interfaces.IToolKitManager;
import org.teotigraphix.dx.patterns.manager.toolkit.ToolKitManagerImpl;

/**
 * The static <code>IToolKitManager</code> interface.
 * 
 * <p>The <code>ToolKitComponent</code> and <code>ToolKitContainer</code>
 * classes use this manager to implement the full tkarchitecture apis.</p>
 * 
 * @copyright Teoti Graphix, LLC
 * @author Michael Schmalle
 * @date 07-07-09
 * 
 * @see org.teotigraphix.dx.patterns.component.DXComponent
 * @see org.teotigraphix.dx.patterns.component.DXContainer
 */
public class ToolKitManager 
{
	include '../../core/Version.as'
	
	//--------------------------------------------------------------------------
	//
	//  IToolKitManager API :: Methods
	//
	//--------------------------------------------------------------------------
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#activate()
	 */
	public static function activate(client:IToolKitComponent):void
	{
		impl.activate(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#deactivate()
	 */
	public static function deactivate(client:IToolKitComponent):void
	{
		impl.deactivate(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateSkinAttachment()
	 */
	public static function validateSkinAttachment(
		client:IToolKitComponent, skin:IEventDispatcher):void
	{
		impl.validateSkinAttachment(client, skin);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateSkinDetachment()
	 */
	public static function validateSkinDetachment(
		client:IToolKitComponent, skin:IEventDispatcher):void
	{
		impl.validateSkinDetachment(client, skin);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateParentChanged()
	 */
	public static function validateParentChanged(
		client:IToolKitComponent, parent:DisplayObjectContainer):void
	{
		impl.validateParentChanged(client, parent);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateInitialization()
	 */
	public static function validateInitialization(client:IToolKitComponent):void
	{
		impl.validateInitialization(client);
	}	
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateInitializationComplete()
	 */
	public static function validateInitializationComplete(client:IToolKitComponent):void
	{
		impl.validateInitializationComplete(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validatePreCommitProperties()
	 */
	public static function validatePreCommitProperties(client:IToolKitComponent):void
	{
		impl.validatePreCommitProperties(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateCommitProperties()
	 */
	public static function validateCommitProperties(client:IToolKitComponent):void
	{
		impl.validateCommitProperties(client);
	}	
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateStyleChanged()
	 */
	public static function validateStyleChanged(
		client:IToolKitComponent, styleProp:String):void
	{
		impl.validateStyleChanged(client, styleProp);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateStylesInitialized()
	 */
	public static function validateStylesInitialized(client:IToolKitComponent):void
	{
		impl.validateStylesInitialized(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateMeasure()
	 */
	public static function validateMeasure(client:IToolKitComponent):void
	{
		impl.validateProperties(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateUpdateDisplayList()
	 */
	public static function validateUpdateDisplayList(
		client:IToolKitComponent, 
		unscaledWidth:Number, unscaledHeight:Number):void
	{
		impl.validateUpdateDisplayList(client, unscaledWidth, unscaledHeight);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateProperties()
	 */
	public static function validateProperties(client:IToolKitComponent):void
	{
		impl.validateProperties(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateSize()
	 */
	public static function validateSize(client:IToolKitComponent):void
	{
		impl.validateSize(client);
	}
	
	/**
	 * @copy org.teotigraphix.dx.interfaces.IToolKitManager#validateDisplayList()
	 */
	public static function validateDisplayList(client:IToolKitComponent):void
	{
		impl.validateDisplayList(client);
	}
		
	//--------------------------------------------------------------------------
	//
	//  Private Class :: Variables
	//
	//--------------------------------------------------------------------------
	
	/**
	 * @private
	 */
	private static var implClassDependency:ToolKitManagerImpl;
	
	/**
	 * @private
	 */
	private static var _impl:IToolKitManager;
	
	/**
	 * Returns the singleton implementation.
	 */
	private static function get impl():IToolKitManager
	{
		if (!_impl)
		{
			_impl = IToolKitManager(ToolKitUtil.getSingleton(
				"org.teotigraphix.dx.interfaces::IToolKitManager"));
		}
		return _impl;
	}	
}
}